<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>Range (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">dom.Range</span>
</div>

<hr/>


  <h2>Classes</h2>
   
<br/>

  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>




  <h2>Global Functions</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.dom.Range.clearSelection"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.dom.Range.</span><span class="entryName">clearSelection<span class="args">(<span class="arg">opt_win</span>)</span>
        </span>
      </div>


     <div class="entryOverview">
       Clears the window's selection.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">opt_win</span>
        : <span class="type">Window=</span>
        <div class="entryOverview">The window to get the selection of.  Defaults to the
    window this class was defined in.</div>
     </td>
   </tr>
  </table>
      </div>
   
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_dom_range.js.source.html#line146">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.dom.Range.createCaret"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.dom.Range.</span><span class="entryName">createCaret<span class="args">(<span class="arg">node</span>,&nbsp;<span class="arg">offset</span>)</span>
        </span>
        &#8658; <span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>
      </div>


     <div class="entryOverview">
       Create a new range wrapper that represents a caret at the given node,
accounting for the given offset.  This always creates a TextRange, regardless
of whether node is an image node or other control range type node.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The node to place a caret at.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">offset</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The offset within the node to place the caret at.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>&nbsp;
            A range wrapper object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_dom_range.js.source.html#line120">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.dom.Range.createFromBrowserRange"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.dom.Range.</span><span class="entryName">createFromBrowserRange<span class="args">(<span class="arg">range</span>,&nbsp;<span class="arg">opt_isReversed</span>)</span>
        </span>
        &#8658; <span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>
      </div>


     <div class="entryOverview">
       Create a new range wrapper from the given browser range object.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">range</span>
        : <span class="type">Range</span><span>&nbsp;|&nbsp;</span><span class="type">TextRange</span>
        <div class="entryOverview">The browser range object.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_isReversed</span>
        : <span class="type">boolean=</span>
        <div class="entryOverview">Whether the focus node is before the anchor
    node.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>&nbsp;
            A range wrapper object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_dom_range.js.source.html#line92">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.dom.Range.createFromBrowserSelection"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.dom.Range.</span><span class="entryName">createFromBrowserSelection<span class="args">(<span class="arg">selection</span>)</span>
        </span>
        &#8658; <span>?</span><span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>
      </div>


     <div class="entryOverview">
       Create a new range wrapper from the given browser selection object.  Note
that this object does not auto-update if the user changes their selection and
should be used as a snapshot.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">selection</span>
        : <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>
        <div class="entryOverview">The browser selection object.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>?</span><span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>&nbsp;
            A range wrapper object or null if there
   was an error.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_dom_range.js.source.html#line56">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.dom.Range.createFromNodeContents"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.dom.Range.</span><span class="entryName">createFromNodeContents<span class="args">(<span class="arg">node</span>,&nbsp;<span class="arg">opt_isReversed</span>)</span>
        </span>
        &#8658; <span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>
      </div>


     <div class="entryOverview">
       Create a new range wrapper that selects the given node's text.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">node</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The node to select.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">opt_isReversed</span>
        : <span class="type">boolean=</span>
        <div class="entryOverview">Whether the focus node is before the anchor
    node.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>&nbsp;
            A range wrapper object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_dom_range.js.source.html#line107">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.dom.Range.createFromNodes"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.dom.Range.</span><span class="entryName">createFromNodes<span class="args">(<span class="arg">anchorNode</span>,&nbsp;<span class="arg">anchorOffset</span>,&nbsp;<span class="arg">focusNode</span>,&nbsp;<span class="arg">focusOffset</span>)</span>
        </span>
        &#8658; <span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>
      </div>


     <div class="entryOverview">
       Create a new range wrapper that selects the area between the given nodes,
accounting for the given offsets.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">anchorNode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The node to anchor on.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">anchorOffset</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The offset within the node to anchor on.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">focusNode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The node to focus on.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">focusOffset</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The offset within the node to focus on.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>&nbsp;
            A range wrapper object.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_dom_range.js.source.html#line134">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.dom.Range.createFromWindow"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.dom.Range.</span><span class="entryName">createFromWindow<span class="args">(<span class="arg">opt_win</span>)</span>
        </span>
        &#8658; <span>?</span><span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>
      </div>


     <div class="entryOverview">
       Create a new selection from the given browser window's current selection.
Note that this object does not auto-update if the user changes their
selection and should be used as a snapshot.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">opt_win</span>
        : <span class="type">Window=</span>
        <div class="entryOverview">The window to get the selection of.  Defaults to the
    window this class was defined in.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span>?</span><span class="type"><a href="class_goog_dom_AbstractRange.html">goog.dom.AbstractRange</a></span>&nbsp;
            A range wrapper object, or null if there
    was an error.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_dom_range.js.source.html#line41">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.dom.Range.hasSelection"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.dom.Range.</span><span class="entryName">hasSelection<span class="args">(<span class="arg">opt_win</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
      </div>


     <div class="entryOverview">
       Tests if the window has a selection.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">opt_win</span>
        : <span class="type">Window=</span>
        <div class="entryOverview">The window to check the selection of.  Defaults to
    the window this class was defined in.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>&nbsp;
            Whether the window has a selection.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_dom_range.js.source.html#line178">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.dom.Range.isReversed"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.dom.Range.</span><span class="entryName">isReversed<span class="args">(<span class="arg">anchorNode</span>,&nbsp;<span class="arg">anchorOffset</span>,&nbsp;<span class="arg">focusNode</span>,&nbsp;<span class="arg">focusOffset</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
      </div>


     <div class="entryOverview">
       Returns whether the focus position occurs before the anchor position.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">anchorNode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The node to anchor on.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">anchorOffset</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The offset within the node to anchor on.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">focusNode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/DOM/Node">Node</a></span>
        <div class="entryOverview">The node to focus on.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">focusOffset</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">The offset within the node to focus on.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>&nbsp;
            Whether the focus position occurs before the anchor
    position.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_dom_range.js.source.html#line194">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>



      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package dom</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="dom.Range"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
